import { IPSAppPortlet } from './ipsapp-portlet';
import { IPSAppPortletCat } from './ipsapp-portlet-cat';
import { IPSAppDataEntity } from '../dataentity/ipsapp-data-entity';
import { IPSControl } from '../../control/ipscontrol';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppPortletImpl extends PSModelObjectImpl implements IPSAppPortlet {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psappdataentity: IPSAppDataEntity | null = null;

  getPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.psappdataentity != null) return this.psappdataentity;
    const value = this.M.getPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.psappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getPSAppDataEntity') as IPSAppDataEntity;
    return this.psappdataentity;
  }

  get psAppDataEntity(): IPSAppDataEntity | null {
    return this.getPSAppDataEntity();
  }

  getPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定应用实体对象');
    }
    return value;
  }

  protected psappportletcat: IPSAppPortletCat | null = null;

  getPSAppPortletCat(): IPSAppPortletCat | null {
    if (this.psappportletcat != null) return this.psappportletcat;
    const value = this.M.getPSAppPortletCat;
    if (value == null) {
      return null;
    }
    this.psappportletcat = this.getPSModel4('app.control.IPSAppPortletCat', value, 'getPSAppPortletCat') as IPSAppPortletCat;
    return this.psappportletcat;
  }

  get psAppPortletCat(): IPSAppPortletCat | null {
    return this.getPSAppPortletCat();
  }

  getPSAppPortletCatMust(): IPSAppPortletCat {
    const value = this.getPSAppPortletCat();
    if (value == null) {
      throw new Error('未指定应用门户部件分类');
    }
    return value;
  }

  protected pscontrol: IPSControl | null = null;

  getPSControl(): IPSControl | null {
    if (this.pscontrol != null) return this.pscontrol;
    const value = this.M.getPSControl;
    if (value == null) {
      return null;
    }
    this.pscontrol = this.getPSModel4('control.IPSControl', value, 'getPSControl') as IPSControl;
    return this.pscontrol;
  }

  get psControl(): IPSControl | null {
    return this.getPSControl();
  }

  getPSControlMust(): IPSControl {
    const value = this.getPSControl();
    if (value == null) {
      throw new Error('未指定控件对象');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get enableAppDashboard(): boolean {
    return this.M.enableAppDashboard;
  }

  get enableDEDashboard(): boolean {
    return this.M.enableDEDashboard;
  }

  get cls(): string {
    return 'PSAppPortletImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'app.control.IPSAppPortlet') return true;
    return super.instanceof(cls);
  }
}
